import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/part-category/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/part-category/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/part-category/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/part-category/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/part-category/submit',
    method: 'post',
    data: row
  });
};

export const parentList = () => {
  return request({
    url: '/api/mes-admin/part-category/list',
    method: 'get'
  });
};

export const getLazyList = (parentId, current, size, params) => {
  return request({
    url: '/api/mes-admin/part-category/lazy-list-page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      parentId
    }
  });
};

export const lazyLoadChild = (parentId) => {
  return request({
    url: '/api/mes-admin/part-category/lazy-list',
    method: 'get',
    params: {
      parentId
    }
  });
};

export const getMenuTree = (current, size, params) => {
  return request({
    url: '/api/mes-admin/part-category/tree',
    method: 'get',
    params: {
      current,
      size,
      params
    }
  });
};
